package com.mall.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mall.dubbo.mappers.OrderSettingMapper;
import com.tanhua.model.domain.OmsOrderSetting;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class OrderSettingApiImpl implements OrderSettingApi {

    @Autowired
    private OrderSettingMapper orderSettingMapper;

    @Override
    public OmsOrderSetting getOrderSetting(Long id) {
        LambdaQueryWrapper<OmsOrderSetting> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(StringUtils.isNotEmpty(String.valueOf(id)), OmsOrderSetting::getId, id);

        OmsOrderSetting omsOrderSetting = orderSettingMapper.selectOne(queryWrapper);
        return omsOrderSetting;
    }

    @Override
    public Boolean updateSetting(OmsOrderSetting oos) {
        if (oos != null) {
            int i = orderSettingMapper.updateById(oos);
            System.out.println(i);

            return true;
        }
        return false;
    }
}
